/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="goods_country")
public class GoodsCountry implements Serializable {
	public GoodsCountry() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Goods goods;
	
	private cn.imvc.app.entities.Country countryId_g;
	
	private cn.imvc.app.entities.Country countryId_h;
	
	private String unitId_g;
	
	private String unitId_h;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_GOODSCOUNTRY_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_GOODSCOUNTRY_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	public void setUnitId_g(String value) {
		this.unitId_g = value;
	}
	
	@Column(name="unitId_g", nullable=true, length=255)	
	public String getUnitId_g() {
		return unitId_g;
	}
	
	public void setUnitId_h(String value) {
		this.unitId_h = value;
	}
	
	@Column(name="unitId_h", nullable=true, length=255)	
	public String getUnitId_h() {
		return unitId_h;
	}
	
	public void setCountryId_g(cn.imvc.app.entities.Country value) {
		this.countryId_g = value;
	}
	
	@OneToOne(targetEntity=cn.imvc.app.entities.Country.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="countryId_g", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Country getCountryId_g() {
		return countryId_g;
	}
	
	public void setCountryId_h(cn.imvc.app.entities.Country value) {
		this.countryId_h = value;
	}
	
	@OneToOne(targetEntity=cn.imvc.app.entities.Country.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="countryId_h", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Country getCountryId_h() {
		return countryId_h;
	}
	
	public void setGoods(cn.imvc.app.entities.Goods value) {
		this.goods = value;
	}
	
	@OneToOne(targetEntity=cn.imvc.app.entities.Goods.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsId", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Goods getGoods() {
		return goods;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("GoodsCountry[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getGoods() != null)
				sb.append("Goods.Persist_ID=").append(getGoods().toString(true)).append(" ");
			else
				sb.append("Goods=null ");
			if (getCountryId_g() != null)
				sb.append("CountryId_g.Persist_ID=").append(getCountryId_g().toString(true)).append(" ");
			else
				sb.append("CountryId_g=null ");
			if (getCountryId_h() != null)
				sb.append("CountryId_h.Persist_ID=").append(getCountryId_h().toString(true)).append(" ");
			else
				sb.append("CountryId_h=null ");
			sb.append("UnitId_g=").append(getUnitId_g()).append(" ");
			sb.append("UnitId_h=").append(getUnitId_h()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
